package com.lgkj.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.lgkj.R;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2018/7/9 0009.
 */

public class MovieNumAdapter extends BaseAdapter {
    private Context context;
    private List<String> url;

    public void setUrl(String url) {
        this.url.add(url);
    }

    public MovieNumAdapter(Context context) {
        this.context = context;
        url = new ArrayList<>();
    }

    @Override
    public int getCount() {
        return url.size();
    }

    @Override
    public String getItem(int i) {
        return url.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder viewHolder;
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.item_news, null);
            viewHolder = new ViewHolder(view);
            view.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) view.getTag();
        }
        viewHolder.tvName.setText("第" + (i + 1) + "集");
        return view;
    }

    static class ViewHolder {
        @BindView(R.id.tv_name)
        TextView tvName;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
